<template>
  <div class="ec-carDetails" :style="{'top': curEleTop * 2 + 'px'}">
    <div class="hl-airConditioningFilter" :style="{'height': 'calc(100vh - '+curViewHeight+')'}">
      <!-- 车型内容 -->
      <div class="hl-carBox">
        <div class="hl-carDetailsBox">
          <div class="hl-carParameter">
            <div class="hl-singleParameterBox" v-for="(item, index) in autoDetails" :key="index">
              <div class="hl-title">
                <span></span>
                <p>{{item.GroupName}}</p>
              </div>
              <div class="hl-parameter">
                <ul>
                  <li v-for="(ele, idx) in item.AutoParamList" :key="idx">
                    <span>{{ele.ParamName}}</span>
                    <p>{{ele.ParamValue}}</p>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="hl-carDetailsClose hl-carDetailsClosePop">
      <a @click="closeCarDetails">收 起</a>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  props: ["autoDetails", "selectorQueryEleMerge"],
  data() {
    return {
      curEleTop: 0 // 当前元素需要展示的top值
    };
  },
  created() {
    let selectorQueryEleMerge = [...new Set(this.selectorQueryEleMerge)];
    let _this = this;
    selectorQueryEleMerge.forEach(item => {
      let myDom = document.querySelector("#" + item);
      _this.curEleTop = _this.curEleTop + myDom.offsetHeight;
    });
  },
  computed: {
    curViewHeight() {
      return this.curEleTop * 2 + 120 + "px";
    }
  },
  methods: {
    closeCarDetails() {
      this.$emit("closeCarDetails", "");
    }
  }
};
</script>

<style scpoed>
/*车型详情*/
.ec-carDetails {
  width: 100%;
  max-height: 100%;
  background: #fff;
  border-top: 0.013333333333333334rem solid #ccc;
  overflow-y: hidden;
  padding: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-sizing: border-box;
}
.hl-airConditioningFilter {
  width: 100%;
  max-height: 100%;
  background: #fff;
  border-top: 0.013333333333333334rem solid #ccc;
  overflow-y: auto;
}
.ec-carDetails ul {
  width: 100%;
  height: 100%;
  float: left;
  clear: left;
  margin: 0;
  padding: 0;
}
.ec-carDetails li {
  width: 100%;
  padding: 0.2rem 0.4rem 0.2rem 0;
  border-bottom: 0.013333333333333334rem solid #dce6ef;
  box-sizing: border-box;
  float: left;
  clear: left;
}
.ec-carDetails li span {
  width: 30%;
  padding-right: 0.32rem;
  font-size: 0.36rem;
  line-height: 0.56rem;
  text-align: left;
  color: #999;
  word-wrap: break-word;
  box-sizing: border-box;
  float: left;
  clear: none;
}
.ec-carDetails li p {
  width: 70%;
  font-size: 0.36rem;
  line-height: 0.56rem;
  text-align: left;
  color: #333;
  word-wrap: break-word;
  box-sizing: border-box;
  float: left;
  clear: none;
  margin: 0;
}
/* ---上面是老样式, 下面是新样式 */
.hl-carDetailsBox {
  width: 100%;
  height: auto;
  background: #edf1f6;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}
.hl-carParameter {
  width: 92%;
  box-sizing: border-box;
  padding-bottom: 0.4rem;
}
.hl-singleParameterBox {
  width: 100%;
  height: auto;
  margin-top: 0.4rem;
  background: #fff;
  border-radius: 0.2rem;
  overflow: hidden;
  box-shadow: 0 0 0.2rem rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}
.hl-title {
  width: 100%;
  height: 1.12rem;
  background: #f6f6f6;
  padding: 0 0.4rem;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}

.hl-title span {
  height: 0.4rem;
  border-radius: 0.04rem;
  /* background: #e74c3c; */
  margin-right: 0.28rem;
  display: block;
}
.hl-title p {
  width: auto;
  height: auto;
  font-size: 0.4rem;
  line-height: 0.56rem;
  text-align: left;
  color: #666;
}
.hl-parameter {
  width: 100%;
  height: auto;
  padding: 0 0.4rem;
  margin-top: -0.013333333333333334rem;
  box-sizing: border-box;
}
.hl-parameter li {
  width: 100%;
  height: auto;
  padding: 0.16rem 0;
  border-top: 0.013333333333333334rem solid #d8d8d8;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.hl-parameter li span {
  width: 3.44rem;
  font-size: 0.36rem;
  line-height: 0.72rem;
  text-align: left;
  color: #8e8e8e;
  flex-shrink: 0;
}
.hl-parameter li p {
  width: 100%;
  font-size: 0.36rem;
  line-height: 0.72rem;
  text-align: left;
  color: #181818;
  flex-shrink: 0;
}
.hl-carDetailsClose {
  width: 100%;
  height: auto;
  margin-top: 0.4rem;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hl-carDetailsClose a {
  width: 1.84rem;
  height: 0.8rem;
  background: #fff;
  border: 1px solid #377de8;
  border-radius: 0.4rem;
  font-size: 0.36rem;
  line-height: 0.64rem;
  text-align: center;
  color: #377de8;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hl-carDetailsClosePop {
  height: 1.6rem;
  background-image: linear-gradient(
    to top,
    rgba(237, 241, 246, 1) 0%,
    rgba(237, 241, 246, 1) 50%,
    rgba(237, 241, 246, 0) 100%
  );
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 777;
}
</style>
